package com.fin.zw.intelligentbot.entity;

import com.fin.zw.intelligentbot.enums.SceneType;
import com.fin.zw.intelligentbot.enums.SourceType;
import com.fin.zw.intelligentbot.enums.Whether;
import lombok.Data;
import org.hibernate.annotations.Table;

import javax.persistence.*;
import java.util.Set;

@Data
@Table(appliesTo = "scene_info",comment="场景信息表")
@Entity
public class SceneInfo extends BaseEntity {

    @Column(columnDefinition = "varchar(100) COMMENT '名称'")
    private String name;

    @Column(columnDefinition = "varchar(100) comment '简称'")
    private String alias;

    @Column(columnDefinition = "varchar(20) COMMENT '是否显示名称'")
    @Enumerated(EnumType.STRING)
    private Whether displayName;

    @Column(columnDefinition = "varchar(20) comment '来源方向(企业方还是超级管理)'")
    @Enumerated(EnumType.STRING)
    private SourceType source;

    @Column(columnDefinition = "varchar(20) COMMENT '类型'")
    @Enumerated(EnumType.STRING)
    private SceneType type;

    @Column(columnDefinition = "varchar(100) COMMENT '场景编号'")
    private String code;

    @Column(columnDefinition = "boolean  COMMENT '是否不使用asr'")
    private Boolean no_asr = false;

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "sec_company", joinColumns = @JoinColumn(name = "sec_id"), inverseJoinColumns = @JoinColumn(name = "company_id"))
    private Set<Company> companies;

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "scene_variable", joinColumns = @JoinColumn(name = "sec_id"), inverseJoinColumns = @JoinColumn(name = "variable_id"))
    private Set<Variable> variables;

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "scene_category", joinColumns = @JoinColumn(name = "sec_id"), inverseJoinColumns = @JoinColumn(name = "category_id"))
    private Set<CategoryLabel> categories;
}
